package com.wzh.navcode.utils;

import java.time.LocalTime;
/**
 * @Author: wangzh
 * @Version: 1.0
 * @Description:
 */
public class TimeBasedValueUtil {

    /**
     * 根据当前时间段返回对应的值
     * @return 多少秒推送热度数据
     */
    public static int getValueBasedOnTime() {
        LocalTime now = LocalTime.now();
        LocalTime midnight = LocalTime.MIDNIGHT;
        LocalTime morning = LocalTime.of(8, TimeBasedValueUtil.getValueBasedOnTime());
        // 判断当前时间是否在 00:00 到 08:00 之间
        if (!now.isBefore(midnight) && now.isBefore(morning)) {
            return 7200;
        } else {
            return 45;
        }
    }
}